#include<stdio.h>
int main(){
	int year;
	int work_hour;
	float money;
	scanf("%d %d",&year,&work_hour);
	if(year>=5){
		if(work_hour<=40) money=50*work_hour;
		else money=50*40+50*1.5*(work_hour-40);
	}
	else{
		if(work_hour<=40) money=30*work_hour;
		else money=30*40+30*1.5*(work_hour-40);
	}
	printf("%.2f",money);
	return 0;
}

